{% extends 'layout.html' %}

{% block content %}

<div class="edit">
    <h3>
        Edit: {{ comment.postTitle }}
    </h3>

    <div class="info">
        by <a href="{{ url ('user_public', username=comment.username) }}">{{ comment.username }}</a>
        <time title="{{ comment.created|title }}" datetime="{{ comment.created|datetime }}"><em> {{ comment.created|ago }} </em></time>
    </div>

    <div style="margin: 2em 0;">
        {{ comment.text|md2html|safe }}
    </div>
    
    {# "shortcut-submit" is a class used exclusively from javascript
     # to submit the form when a key (Ctrl+Enter) is pressed.
     #}
    <form action="" method="post" class="shortcut-submit">
        <input type="hidden" name="comment" value="{{ comment.hashId }}" />
        
        <div style="margin: 2em 0;">
            <textarea name="text" rows=10 class="form-control">{{ comment.text }}</textarea>
        </div>

        <div>
            <input type="submit" class="button button_info" value="Save changes" />
        </div>
    </form>
</div>

{% endblock %}
